{include file="public/header" /}

<script charset="utf-8" src="http://www.wsc.com/Manage/Admin/Public/myeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="http://www.wsc.com/Manage/Admin/Public/myeditor/lang/zh_CN.js"></script>
<script>
    KindEditor.ready(function(K) {
        var editor1 = K.create('.editor_id', {
            filterMode: false,//是否开启过滤模式
            cssPath : 'http://www.wsc.com/Manage/Admin/Public/myeditor/plugins/code/prettify.css',
            uploadJson : 'http://www.wsc.com/Manage/Admin/Public/myeditor/php/upload_json.php',
            fileManagerJson : 'http://www.wsc.com/Manage/Admin/Public/myeditor/php/file_manager_json.php',
            allowFileManager : true,
            afterBlur : function() {
                this.sync();
                K.ctrl(document, 13, function() {
                    K('form[name=formlist]')[0].submit();
                });
                K.ctrl(this.edit.doc, 13, function() {
                    K('form[name=formlist]')[0].submit();
                });
            }
        });

        var editor = K.editor({
            allowFileManager : true
        });


    });


    $(document).ready(function(){
        $(".delete").click(function(){
            var v=this.title;
            $.get('/Admin-News-Titlepic-id-'+v+".html",null,function(data){
                $(".img"+v).remove();
            });
        })
    });
</script>
<script>
    KindEditor.ready(function(K) {
        var editor = K.editor({
            allowFileManager : true
        });
        K('#img1_btn').click(function() {
            editor.loadPlugin('image', function() {
                editor.plugin.imageDialog({
                    imageUrl : K('#img1').val(),
                    clickFn : function(url, title, width, height, border, align) {
                        K('#img1').val(url);
                        editor.hideDialog();
                    }
                });
            });
        });    K('#insert_file1').click(function() {
            editor.loadPlugin('insertfile', function() {
                editor.plugin.fileDialog({
                    fileUrl : K('#file1').val(),
                    clickFn : function(url, title) {
                        K('#file1').val(url);
                        editor.hideDialog();
                    }
                });
            });
        });

    });
</script>




















<div class="layui-fluid">
    <div class="layui-row">

        <form class="layui-form" action="" method="post">

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    所属栏目
                </label>
                <div class="layui-input-inline">
                    <select name="pid">
                        <option value="0" {if condition="$v['pid'] eq 0"} selected{/if}>无</option>
                        {volist name="sort" id="s"}
                            <option value="{my$s.id}" {if condition="$s['id'] eq $v['pid']"} selected{/if}>{:str_repeat("&nbsp;&nbsp;└",$s['level'])}{$s.catname}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    栏目模块
                </label>
                <div class="layui-input-inline">
                    <select name="pid">
                        <option value="0|0|0" {if condition="$s['id'] eq $v['model_id']"} selected{/if}>请选择</option>
                        {volist name="sort2" id="s"}
                            <option value="{$s.id}|{:get_model_zd($s['id'],'model_c')}|{:get_model_zd($s['id'],'model_a')}" {if condition="$s['id'] eq $v['model_id']"} selected{/if}>{$s.model_name}</option>
                        {/volist}

                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>栏目名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="username" name="catname" required="" lay-verify="required" value="{$v.catname}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    英文名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="username" name="encatname" required=""   value="{$v.encatname}" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    页面标题
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="seotitle" name="seotitle" required=""  value="{$v.seotitle}" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    页面关键字
                </label>
                <div class="layui-input-inline">
                    <textarea name="seokeywords"  style="width:520px;height:100px;" class="layui-textarea">{$v['seokeywords']}</textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    页面描述
                </label>
                <div class="layui-input-inline">
                    <textarea name="seodescription"  style="width:520px;height:100px;" class="layui-textarea">{$v['seodescription']}</textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>所属模板
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="username" name="templet" required="" lay-verify="required" value="{$v['templet']}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>控制器
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="username" name="sort_c" required="" lay-verify="required" value="{$v['sort_c']}"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    <span class="x-red">*</span>操作方法
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="username" name="sort_a" required="" lay-verify="required" value="{$v['sort_a']}"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">图片数量</label>
                <div class="layui-input-inline">
                    <input type="text" name="imgnum" value="{$v['imgnum']}" placeholder="请输入图片数量" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">图片尺寸</label>
                <div class="layui-input-inline">
                    <input type="text" name="imgsize" value="{$v['imgsize']}" placeholder="请输入图片尺寸 多个用,分割" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">图片名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="imgname" value="{$v['imgname']}" placeholder="请输入图片名称 多个用,分割" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">多图尺寸</label>
                <div class="layui-input-inline">
                    <input type="text" name="titleimgsize" value="{$v['titleimgsize']}" placeholder="请输入多图上传尺寸" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">内部自定义</label>
                <div class="layui-input-inline">
                    <input type="text" name="sort_url" id="sort_url" value="{$v['sort_url']}" placeholder="请输入内部自定义链接" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">外部跳链接</label>
                <div class="layui-input-inline">
                    <input type="text" name="outlinkurl" value="{$v['outlinkurl']}" placeholder="请输入外部跳链接" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">前台文件名</label>
                <div class="layui-input-inline">
                    <input type="text" name="inlinkurl" value="{$v['inlinkurl']}" placeholder="请输入前台文件名" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">子栏目权限</label>
                <div class="layui-input-block">
                    <input type="radio" name="isopen" value="1" title="开放"  {:get_my_checked($v['isopen'],1)}>
                    <input type="radio" name="isopen" value="0" title="关闭"  {:get_my_checked($v['isopen'],0)}>
                </div>
            </div>
            <else/>
            <input type="hidden" name="templet" value="{$v['templet']}">
            <input type="hidden" name="sort_c" value="{$v['sort_c']}">
            <input type="hidden" name="sort_a" value="{$v['sort_a']}">
            <input type="hidden" name="imgnum" value="{$v['imgnum']}">
            <input type="hidden" name="titleimgsize" value="{$v['titleimgsize']}">
            <input type="hidden" name="imgsize" value="{$v['imgsize']}">
            <input type="hidden" name="imgname" value="{$v['imgname']}">
            <input type="hidden" name="sort_p" value="{$v['sort_p']}">
            <input type="hidden" name="outlinkurl" value="{$v['outlinkurl']}">
            <input type="hidden" name="inlinkurl" value="{$v['inlinkurl']}">
            <input type="hidden" name="isopen" value="{:get_sort_zd($v['pid'],'isopen')}">
            </if>
            <?php
                $course = controller("Common");
           ?>






                {for start="1" end="config('BANNER_NUM')+1"}
                    <?php $zd="img$i";?>
                    <div class="layui-form-item">
                        <label class="layui-form-label">{:$course->get_banner_imgname($i)}</label>
                        <div class="layui-input-inline">
                            <input type="text" name="img{$i}" id="img{$i}" value="{$v['img'.$i]}" placeholder="请上传配置图片"  class="layui-input">
                        </div>


                        <button type="button" id="img{$i}_btn" class="layui-btn" data-des="ico">
                            <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>
                        <font color="red">图片大小:{:get_cfg_var("post_max_size")}内,图片尺寸：{:$course->get_banner_imgsize($i)}px</font>{:get_img_show($v['img'.$i])}
                    </div>
                {/for}


            <div class="layui-form-item">
                <label class="layui-form-label">栏目排序</label>
                <div class="layui-input-inline" style="width: 120px;">
                    <input type="text" name="disorder" value="{$v['disorder']}" placeholder="请输入栏目排序" class="layui-input" style="width: 120px;">
                </div>
                数字越小越在前
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="status" value="1" title="启用"  {:get_my_checked($v['status'],1)}>
                    <input type="radio" name="status" value="0" title="禁用"  {:get_my_checked($v['status'],0)}>
                </div>
            </div>






            <div class="layui-form-item">
                <label for="username" class="layui-form-label">
                    状态
                </label>
                <div class="layui-input-inline">
                    <input type="radio" name="status" value="1" title="启用"  {if condition="$v['status'] eq 1"} checked{/if}>
                    <input type="radio" name="status" value="0" title="禁用"  {if condition="$v['status'] eq 0"} checked{/if}>
                </div>
            </div>


            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="add" lay-submit="">
                    确认
                </button>
            </div>
        </form>
    </div>
</div>
</body>

</html>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
            ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            nikename: function(value){
                if(value.length < 5){
                    return '昵称至少得5个字符啊';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });



        form.on('checkbox(father)', function(data){

            if(data.elem.checked){
                $(data.elem).parent().siblings('td').find('input').prop("checked", true);
                form.render();
            }else{
                $(data.elem).parent().siblings('td').find('input').prop("checked", false);
                form.render();
            }
        });


    });
</script>
